package club.zhangliyuanblog.controller;

import club.zhangliyuanblog.entity.CommonResult;
import club.zhangliyuanblog.entity.Payment;
import club.zhangliyuanblog.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author liyuan.zhang
 * @date 2021/4/22 9:50
 */
@Slf4j
@RestController
@RequestMapping("/payment")
public class OrderController {

    @Resource
    private PaymentFeignService paymentFeignService;

    @GetMapping("/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable Long id){
        return paymentFeignService.getPaymentById(id);
    }

    @GetMapping(value = "/timeout/{timeout}")
    public String testFeignTimeOut(@PathVariable("timeout") Integer timeout){
        return paymentFeignService.testTimeOut(timeout);
    }
}
